<div class="col-md-12 services pb-30 newsletter">
	<div class="wrapper">
		<div class="col-md-4 col-sm-4 text-right news-icon hidden-xs ">
			<img src="<?php echo Yii::app()->getBaseUrl()?>/images/newsletter-icon.png" title="newsletter" alt="newsletter"/>
		</div>
			
		<div class="col-md-8 col-sm-8 text-left">
			<h1 class="headings text-upper">Want Our Newsletter?</h1><div class="clarfix"></div>
			<p class="text-black"><strong>Sign up here to know everything before anybody else does</strong></p>
				<div class="clarfix"></div>
			<?php 
				$news = new Newsletters();
				$form=$this->beginWidget('CActiveForm', array(
						'action' => $this->createUrl('site/newsletter'),
						'id'=>'news-form',
						'enableAjaxValidation'=>false,
						'clientOptions'=>array(
					      'validateOnSubmit'=>true,
					     ),
				
					)); 
			?>
				<div class="col-md-5 col-xs-9 text-right row form-group">
					<?php echo $form->textField($news,'email', array('class'=>'form-control', 'placeholder'=>'Email Address')); ?>
				</div>
				<div class="col-md-7 col-xs-3 text-left">
					<?php echo CHtml::ajaxSubmitButton('Subscribe', Yii::app()->getBaseUrl().'/site/newsletter/',
                 array(
                     'dataType'=>'json',
                     'type'=>'post',
                     'success'=>'function(data) {
                        if(data.status=="success"){
                         $("#news-form")[0].reset();
                 		 $(".newsletter .news-error").html("Thanks for subscribing our newsletters!");
                        }
                        else{
                 		 $(".newsletter .form-group").addClass("has-error");
                 		 $(".newsletter #Newsletters_email").focus();
                 		 $.each(data, function(key, val) {
                 			$(".newsletter .news-error").text(val);
                 		 });
                 		 $(".newsletter .news-error").html();
                        }       
                    }',
                 	'error' => 'function(data){
                 		$(".newsletter .news-error").html("Oops, please try after some time");
                 	}',
                     'beforeSend'=>'function(){
						$(".newsletter .form-group").removeClass("has-error");
                        $(".newsletter .news-error").html("<img src='.Yii::app()->getBaseUrl().'/images/loading.gif alt=loading... />");
                      }'
                     ),array('id'=>'mybtns','class'=>'btn btn-danger text-upper')); ?>
				</div>
				
			<?php $this->endWidget(); ?>
			<div class="clearfix"></div>
		</div> 
	</div>
	<p class="col-md-12 text-center text-white news-error"></p>
</div>